import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useAppStore = defineStore('app', () => {
  const collapsed = ref(false)
  const loading = ref(false)

  // 切换侧边栏折叠状态
  const toggleSidebar = () => {
    collapsed.value = !collapsed.value
  }

  // 设置加载状态
  const setLoading = (status: boolean) => {
    loading.value = status
  }

  return {
    collapsed,
    loading,
    toggleSidebar,
    setLoading
  }
})